#include<iostream>

class ValueInRange {
	private: 
	float x;
	Range range;

	public:
	ValueInRange(float x, Range range);
	bool isCorrupted();
	float getX();
	bool setX(float x);
	bool setRange(Range r);

	public ValueInRange::ValueInRange(float x, Range range) {
		this.x = x;
		this.setRange(range);
	}
	
	public ValueInRange::bool isCorrupted(){
		return range.rangeCheck(x);
	}

	public ValueInRange::float getX() {
		return x;
	}

	public ValueInRange::bool setX(float x) {
		if(range==NULL)
			return false;
		if(range.rangeCheck(x)){
			this.x = x;	
			return true;
		}
		return false;
	}

	public ValueInRange::bool setRange(Range r){
		if(r.rangeCheck(x)){
			if(this.range!=NULL)
				this.range.lockDown();
			r.lockUp();
			this.range=r;
			return true;
		}
		return false;
	}
}
